import Cookies from 'js-cookie'

const TokenKey = 'RL-Token'
const ExpiresIn = 1
const CIDCTokenKey = 'CIDC-Token'
const JSESSIONID = 'JSESSIONID'
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token, expires = ExpiresIn) {
  return Cookies.set(TokenKey, token, {
    expires
  })
}

export function removeJSESSIONID() {
  return Cookies.remove(JSESSIONID)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getCIDCToken() {
  return Cookies.get(CIDCTokenKey)
}

export function setCIDCToken(token, expires = ExpiresIn) {
  return Cookies.set(CIDCTokenKey, token, {
    expires
  })
}

export function removeCIDCToken() {
  return Cookies.remove(CIDCTokenKey)
}

export function setData(dataKey,data) {
  return Cookies.set(dataKey,data)
}
export function getData(dataKey) {
  return Cookies.get(dataKey)
}
export function removeData(dataKey) {
  return Cookies.remove(dataKey)
}
